import { catchApiError } from '../util/index';
import { Tools } from 'weaver-mobile';

// 督办详情form
export const getProInfo = (params) => {
    function* gen(params) {
        const options = {
            method: 'GET',
            url: '/api/govern/pro/getProInfo',
            params: {
                ismobile: 1,
                ...params
            }
        };
        yield Tools.callApi(options);
    }
    return gen(params).next().value;
}
// 指导意见长列表
export const getInstructList = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/base/getInstructList',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 事项长列表
export const getProListResult = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/pro/getProListResult',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 任务长列表
export const getMyTaskList = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/task/getMyTaskList',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 关注长列表
export const getAttentionTaskList = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/task/getAttentionTaskList',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 提醒长列表
export const buzhidao = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/task/getAttentionTaskList',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 高级搜索
// export const getTaskListConditions = params => {
//     const options = {
//         method: 'GET',
//         url: '/api/govern/task/getTaskListConditions',
//         params: {
//             ismobile: 1,
//             ...params
//         }
//     };
//     return Tools.callApi(options).then(catchApiError);
// };
// 获取搜索历史
export const getHistorySearch = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/pro/getHistorySearch',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//添加搜索历史
export const addHistorySearch = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/pro/addHistorySearch',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//清除搜索历史
export const clearHistory = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/pro/clearHistory',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//发布评论
export const saveInstruct = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/base/saveInstruct',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//发布汇报
export const reportTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/reportTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//获取按钮信息/下发操作
export const getCardBtnInfo = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/base/getCardBtnInfo',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//我的关注
export const attentTask = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/base/attentTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//  取消关注
export const disAttentTask = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/base/disAttentTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//  完结
export const finishTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/finishTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//  废弃
export const cancelTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/cancelTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 共享
export const addShare = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/base/addShare',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 获取共享信息
export const getShareList = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/base/getShareList',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//删除共享信息
export const delBatchShare = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/base/delBatchShare',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 变更
export const getChangeTaskLayout = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/task/getChangeTaskLayout',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 变更提交
export const changeTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/changeTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 延期办结申请 触发方式（0卡片触发、1触发流程）
export const getActionSetting = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/task/getActionSetting',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 催办/反馈
export const getTaskInfo = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/task/getTaskInfo',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 催办提交
export const remindTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/remindTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 下发
export const distribute = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/distribute',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//  签收
export const signingTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/signingTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//  分解
export const getDecomposeTaskLayout = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/task/getDecomposeTaskLayout',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//  分解提交
export const decomposeTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/decomposeTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 成文表格
export const getReportList = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/base/getReportList',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//重新开启
export const reopenTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/reopenTask',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
//删除
export const deleteTask = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/task/d/task',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 新建分类列表
export const getCategoryGroup = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/category/getCategoryGroup',
        params: {
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};
// 新建new form
export const governSetupInit = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/category/governSetupInit',
        params: {
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
}
//新建保存
export const saveAdd = params => {
    const options = {
        method: 'POST',
        url: '/api/govern/pro/saveProInfo',
        params: {
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
}
// 查看反馈
export const getProFeedBack = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/pro/getProFeedBack',
        params: {
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
}
// 6个穿透项 
// 参数：
// flag ："getnumber" （六个数量） "top"(快捷列表)  "getlist"(六个数量跳的列表)

// type：六个数量跳的列表用的 ongoing overtime will_overtime new_instruct new_feedback new_urgent
export const getProjectList = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/mobile/getProjectList',
        params: {
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
}
//整体监控
export const getProjectCount = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/pro/getProjectCount',
        params: {
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
}
//脑图
export const getMindData = params => {
    const options = {
        method: 'GET',
        url: '/api/govern/mobile/getMindData',
        params: {
            ismobile: 1,
            ...params
        }
    };
    return Tools.callApi(options).then(catchApiError);
};

